var e = getApp();

Page({
    data: {
        shoplist: [ {
            name: "采购金",
            price: "8451.26"
        }, {
            name: "网店收入",
            price: "8451.26"
        }, {
            name: "已完成订单数",
            price: "896"
        }, {
            name: "累计订单金额",
            price: "622556"
        } ],
        nume: [ {
            icon: "icon-fontclass-dianpu1",
            color: "#fd6154",
            name: "进入店铺"
        }, {
            icon: "icon-fontclass-erweima",
            color: "#0ed79b",
            name: "店铺二维码"
        }, {
            icon: "icon-fontclass-huiyuandengji",
            color: "#ff961f",
            name: "会员管理"
        }, {
            icon: "icon-fontclass-shangpindingdan",
            color: "#22a6ff",
            name: "网店订单"
        }, {
            icon: "icon-fontclass-shangpindingdan",
            color: "#22a6ff",
            name: "采购订单"
        }, {
            icon: "icon-fontclass-tichengmingxi",
            color: "#8562e6",
            name: "采购金明细"
        }, {
            icon: "icon-fontclass-shenhe1",
            color: "#fd6154",
            name: "售后审核"
        }, {
            icon: "icon-fontclass-wdeguanzhu",
            color: "#11da9f",
            name: "债务人申请"
        } ],
        info: [],
        debtor_id: ""
    },
    onLoad: function(e) {
        wx.setNavigationBarTitle({
            title: "债务人"
        });
    },
    tourl: function(a) {
        console.log(a);
        var t = a.currentTarget.dataset.item.name;
        if ("进入店铺" == t) {
            if (!this.data.debtor_id) return void e.tips("你还不是债务人或者债务人身份已过期");
            wx.navigateTo({
                url: "/packageF/debt/debtor/debtorShop/debtorShop?kid=" + this.data.debtor_id
            });
        } else "店铺二维码" == t ? wx.navigateTo({
            url: "/packageF/debt/debtShopCode/debtShopCode"
        }) : "会员管理" == t ? wx.navigateTo({
            url: "/packageF/debt/userManagement/userManagement?type=2"
        }) : "网店订单" == t ? wx.navigateTo({
            url: "/packageA/member/myOrder_v2/myOrder_v2?member_type=4"
        }) : "采购订单" == t ? wx.navigateTo({
            url: "/packageA/member/myOrder_v2/myOrder_v2?member_type=2"
        }) : "采购金明细" == t ? wx.navigateTo({
            url: "/packageF/debt/purchaseDetails/purchaseDetails"
        }) : "售后审核" == t ? wx.navigateTo({
            url: "/packageF/debt/debtorAudit/debtorAudit"
        }) : "债务人申请" == t && wx.navigateTo({
            url: "/packageF/debt/debtapply/debtapply?type=2"
        });
    },
    onReady: function() {},
    onShow: function() {
        this.getData();
    },
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    getData: function() {
        var a = this, t = e.getNetAddresss("plugin.debt-shop.frontend.debt-member.getDebtData");
        e._getNetWork({
            url: t,
            data: {
                member_type: 2
            },
            success: function(e) {
                var t = e.data;
                if (1 == t.result) {
                    a.setData({
                        info: t.data,
                        debtor_id: t.data.default_debtor_id
                    });
                    var o = a.data.info;
                    a.data.shoplist.forEach(function(e, a) {
                        console.log(e.name), "采购金" == e.name ? e.price = o.debtor_credit : "网店收入" == e.name ? e.price = o.sum_debtor_income : "已完成订单数" == e.name ? e.price = o.order_count : "累计订单金额" == e.name && (e.price = o.order_price);
                    }), a.setData({
                        shoplist: a.data.shoplist,
                        debtor_id: t.data.default_debtor_id
                    });
                } else wx.showToast({
                    icon: "none",
                    title: t.msg,
                    duration: 1500
                });
            },
            fail: function(e) {
                console.log(e);
            }
        });
    }
});